<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ include file="/commons/jsp/taglibs.jsp"%>
<%@taglib uri="http://www.framework.com/taglib" prefix="frame"%>
  <head>
	<title>公共平台 </title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<!-- 样式文件的引入 -->
	<link href="${ctx}/commons/css/style.css" rel="stylesheet" type="text/css"/>
	<link rel="stylesheet" type="text/css" href="${ctx}/commons/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="${ctx}/commons/themes/icon.css">
	<!-- jqueryUI JS文件的引入 -->
	<script type="text/javascript" src="${ctx}/commons/js/jquery-1.8.0.min.js"></script>
	<script type="text/javascript" src="${ctx}/commons/js/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="${ctx}/commons/js/easyui-extends-validate.js"></script>
	<!-- jqueryUI国际化 -->
	<script type="text/javascript" src="${ctx}/commons/js/easyui-lang-zh_CN.js"></script>
	<!-- 开发使用的公用js方法 -->
	<script type="text/javascript" src="${ctx}/commons/js/common.js"></script>
	<!-- 开发国际化的引用，主要完成后台信息在前台提示的国际化，一定要放在最后 -->
	<script type="text/javascript">var ctx = '${ctx}';var actionExt = "action";var i18n = new Object();</script>
	<script src="${ctx}/commons/js/i18n/message_zh_CN.js" type="text/javascript"></script>
  </head>
  
	<body>
		<div class="easyui-layout" data-options="fit:true,border:false">
			<div data-options="region:'center',border:false"
				style="padding: 4px;">
				<input type="hidden" id="revoke" value="${revoke}" />
				<table id="listOrderTable" class="easyui-datagrid"
					data-options="singleSelect:true,toolbar:'#tb',method:'post',rownumbers:true,fit:true,fitColumns:true,border:true,
					pagination:true,remoteSort:true,multiSort:true,striped:true,onLoadSuccess:function(data){$('#'+paramObj.searchID).attr('disabled',false);},
					url:'${ctx }/workflow/model/list'"}>
					<thead>
						<tr>
							<th data-options="field:'id',width:20,title:'ID',sortable:true" align="center"></th>
							<th data-options="field:'key',width:20,title:'KEY',sortable:true" align="center"></th>
							<th data-options="field:'name',width:20,title:'Name',sortable:true" align="center"></th>
							<th data-options="field:'version',width:20,title:'Version',sortable:true" align="center"></th>
							<th data-options="field:'createTime',width:20,title:'创建时间',sortable:true" align="center"></th>
							<th data-options="field:'lastUpdateTime',width:20,title:'最后更新时间',sortable:true" align="center"></th>
							<th data-options="field:'processDefinitionId',width:20,title:'元数据',sortable:true" align="center"></th>
							<th data-options="field:'metaInfo',width:20,title:'操作',formatter:getOptionsBtn" align="center"></th>
						</tr>
					</thead>
				</table>
				<div id="tb" style="display: none;">
					<div>
						<a href="javascript:void(0);" onclick="openDataDialog();"
							class="easyui-linkbutton" iconCls="icon-add" plain="true">创建</a>
					</div>
				</div>
			</div>
		</div>
	</body>
	<script type="text/javascript">
	//初始化表格对应的js对象
		var paramObj;
		$(function() {
			//初始化表格对象数据
			paramObj = new initParams(
					{
						paramObjName : 'paramObj',//表格对应的实体对象名称，好区分多个表格情况下的对象
						tableId:'listContentTable',
						addDataFormId:'addContentDataForm',
						showDialogId:'shoContentDialog',
						searchID:'searchContent',
						resetSearchID:'resetSearchContent',
						searchFormID:'searchContentForm',
						updateUrl:'${ctx}/business/webcontent/input?id=',
						deleteUrl:'${ctx}/business/webcontent/remove',
						addDialogWidth:980,
						addDialogHeight:600,
						ctx:'${ctx}',
						addDialogTitle:'文章信息'
					});
		});

		//操作
		function getOptionsBtn(value, row, index){
			var html="<a href='${ctx}/service/editor?id="+row.id+"' target='_blank'>编辑</a>"
					+" <a href='${ctx}/workflow/model/deploy/"+row.id+"'>部署</a>"
					+" <a href='${ctx}/workflow/model/export/"+row.id+"' target='_blank'>导出</a>"
                    +" <a href='${ctx}/workflow/model/delete/"+row.id+"'>删除</a>";
			
			return html;
		}

		/**
		 * 查看流程追踪
		 */	
		 function openProcessTracePicture(id){
			top.$('#firstLevelDialog').dialog({    
			    title:"流程追踪",  
			    iconCls:'icon-view',
			    width: 900,    
			    height: 520,    
			    closed: false,    
			    inline : true,
			    cache: false,    
			    href: "${ctx }/workflow/process/trace?processInstanceId=" + id,    
			    modal: true,
			    buttons : [{
						text:"取消",
						iconCls:'icon-cancel',
						handler:function(){
							top.$('#firstLevelDialog').dialog('close');
						}}]
			});
		}


		/**
		 * 创建模型对话框
		 */	
		function openDataDialog(){
			top.$('#firstLevelDialog').dialog({    
			    title:paramObj.addDialogTitle,  
			    iconCls:'icon-view',
			    width: 600,    
			    height: 300, 
			    closed: false,    
			    inline : true,
			    cache: false,    
			    href: "${ctx }/workflow/model-list-input.jsp",    
			    modal: true,
			    buttons : [{text:paramObj.saveButton,
			    		id:'saveEntityBt',
						iconCls:'icon-ok',
						handler:function(){
							//表单提交
							saveModel();
						}
					},{
						text:paramObj.cancelButton,
						iconCls:'icon-cancel',
						handler:function(){
							top.$('#firstLevelDialog').dialog('close');
						}}]
			});
			//top.$('#firstLevelDialog').dialog("center");
		}

		//保存Model
		function saveModel(){
			//alert(top.$('#modelForm').attr("action"));
			$.ajax({
				type: "POST",
				timeout:20000,
				url:top.$('#modelForm').attr("action"),
				data:top.$("#modelForm").serialize(),
				success: function(data){
					//var result = $.trim(res.responseText);
					alert(1);
				},
				error:function(data){
					alert(2);
				}
			});
		}
</script>